@import './vars.less';

.inline-flex-center {
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

.text-ellipsis (@lines:2) when (@lines <= 1) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.text-ellipsis (@lines:2) when (@lines > 2) {
  display: -webkit-box;
  /*! autoprefixer: ignore next */
  -webkit-box-orient: vertical;
  -webkit-line-clamp: @lines;
  overflow: hidden;
  text-overflow: ellipsis;
}

//不可用状态
.disabled(@bgColor:#e6e6e6, @textColor:#ababab) {
  background-color: @bgColor !important;
  color: @textColor !important;
  cursor: not-allowed !important;
}
//绝对居中(相对于固定宽高的容器)
.absolute-center(@width, @height) {
  position: absolute;
  left: 50%;
  top: 50%;
  margin-left: -(@width / 2);
  margin-top: -(@height / 2);
  width: @width;
  height: @height;
}

.click-active--opacity {
  &:active {
    background: #f2f3f5;
  }
}

.flex(@v:1) {
  -webkit-box-flex: @v;
  -webkit-flex: @v;
  flex: @v;
}

//弹性盒对象元素的顺序
.flex-order(@order:0) {
  -webkit-box-ordinal-group: @order;
  order: @order;
}

//水平，垂直方向居中
.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.text-ellipsis-1 {
  .text-ellipsis(1);
}

.flex-vertical-center(@height) {
  display: flex;
  align-items: center;
  height: @height;
}

/*移动端ios 回弹*/
.ios-bounce-android {
  over-flow: auto; /* winphone8和android4+ */
  -webkit-overflow-scrolling: touch; /* ios5+ */
}

/*滚动条样式*/
.div--webkit--scrollbar(@bg: #d2cece) {
  @media screen and(max-width:720px) {
    /* 设置滚动条的样式 */
    &::-webkit-scrollbar {
      width: 10px;
      height: 10px;
    }

    /* 滚动槽 */
    &::-webkit-scrollbar-track {
      //-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
      //border-radius: 8px;
    }
    // 滚动条滑块
    &::-webkit-scrollbar-thumb {
      background-color: @bg;
      background-clip: padding-box;
      border: 3px solid transparent;
      border-radius: 7px;
    }

    &::-webkit-scrollbar-thumb:hover {
      background-color: @primary-color;
      background-clip: padding-box;
      border: 3px solid transparent;
      border-radius: 7px;
      cursor: grab;
    }

    &::-webkit-scrollbar-thumb:window-inactive {
      background-color: @primary-color;
      background-clip: padding-box;
      border: 3px solid transparent;
      border-radius: 7px;
    }
  }
}

.div--webkit--scrollbar-hidden() {
  &::-webkit-scrollbar {
    display: none;
  }
}
